<template>
  <div>
  	<img id="cover" ref="img" src="/static/img/cover.gif">
  	<div id="start-btn">
  		<router-link to='/question'>
  			<img id="start-img" src="/static/img/start.png">
  		</router-link>
  	</div>
    
  </div>
</template>

<script>

export default {
  data () {
    return {
      
    }
  },
  mounted: function() {
  	this.$refs.img.onload = () => {
  		// console.log($('#cover').height())
  		let height = $('#cover').height()
  		let margintop = -height * 0.2
  		// console.log(margintop)
  		$('#start-btn').css('marginTop', margintop)
  	}
  	
    // 初始化cookie
    this.$cookie.set('score', 0)

    // redis记录访问数量
    this.setViewCount()
  	
  },
  methods: {
    setViewCount: function() {
      this.$axios.get(`setViewCount.php`)
            .then(res => {
              console.log(res)
            })
            .catch(error => {
              console.log(error)
            })
    },
  }
}
</script>

